package org.openmore.platform.framework;

import org.openmore.common.framework.ThreadLocalConfig;
import org.openmore.platform.entity.User;

/**
 * Created by michaeltang on 2018/8/23.
 */
public class MyThreadLocalConfig extends ThreadLocalConfig {
    private static ThreadLocal<User> localUser = new ThreadLocal<>();

    /**
     * 获得线程内全局的当前登录人员，如果非登录用户，返回空
     * @return
     */
    public static User getUser() {
        return localUser.get();
    }

    /**
     * 设置线程内全局的当前登录人员
     */
    public static void setUser(User user) {
        localUser.set(user);
    }
}
